﻿Public Class PicturePage
    Inherits System.Web.UI.UserControl
    Dim XCut, Battens4, Battens5, Trioptimal, TrimStripes, Membrane, Race, Cunningham As Boolean
    Dim YarnColour, TrimStripeColour, SailType As String
    Dim Reef, TierCode As Integer

    Public WriteOnly Property CtlCunningham() As Boolean
        Set(ByVal value As Boolean)
            Cunningham = value
        End Set
    End Property

    Public WriteOnly Property CtlRace() As Boolean
        Set(ByVal value As Boolean)
            Race = value
        End Set
    End Property

    Public WriteOnly Property CtlTrimStripes() As Boolean
        Set(ByVal value As Boolean)
            TrimStripes = value
        End Set
    End Property

    Public WriteOnly Property CtlSailtype() As String
        Set(ByVal value As String)
            SailType = value
        End Set
    End Property

     Public WriteOnly Property CtlXCut() As Boolean
        Set(ByVal value As Boolean)
            XCut = value
        End Set
    End Property

    Public WriteOnly Property CtlTrioptimal() As Boolean
        Set(ByVal value As Boolean)
            Trioptimal = value
        End Set
    End Property

    Public WriteOnly Property CtlMembrane() As Boolean
        Set(ByVal value As Boolean)
            Membrane = value
        End Set
    End Property

    Public WriteOnly Property CtlBattens4() As Boolean
        Set(ByVal value As Boolean)
            Battens4 = value
        End Set
    End Property

    Public WriteOnly Property CtlBattens5() As Boolean
        Set(ByVal value As Boolean)
            Battens5 = value
        End Set
    End Property

    Public WriteOnly Property CtlYarnColour() As String
        Set(ByVal value As String)
            YarnColour = value
        End Set
    End Property

    Public WriteOnly Property CtlTrimStripeColour() As String
        Set(ByVal value As String)
            TrimStripeColour = value
        End Set
    End Property

    Public WriteOnly Property CtlReef() As Integer
        Set(ByVal value As Integer)
            Reef = value
        End Set
    End Property

    Public WriteOnly Property CtlTierCode() As Integer
        Set(ByVal value As Integer)
            TierCode = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Call MakeInvisible()

        If SailType = "M" Then
            Call DrawMain()
        ElseIf SailType = "G" Then
            Call DrawGenoa()
        ElseIf SailType = "J" Then
            Call DrawJib()
        End If
        'MainGrey.Visible = True
        ' MainGradient.Visible = True

    End Sub

    Sub MakeInvisible()
        'Main
        Main_Seams_XCut.Visible = False
        Main_Seams_Trioptimal.Visible = False
        Main_Patches_XCut.Visible = False
        Main_Grey.Visible = False
        Main_Yellow.Visible = False
        Main_Black.Visible = False
        Main_Gradient.Visible = False
        Main_Battens_XCut_4.Visible = False
        Main_MembraneA_Black.Visible = False
        Main_MembraneA_White.Visible = False
        Main_MembraneA_Yellow.Visible = False
        Main_MembraneB_Black.Visible = False
        Main_MembraneB_White.Visible = False
        Main_MembraneB_Yellow.Visible = False
        Main_MembraneC_Black.Visible = False
        Main_MembraneC_White.Visible = False
        Main_MembraneC_Yellow.Visible = False
        Main_Patches_Membrane.Visible = False
        Main_Patches_Trioptimal.Visible = False
        Main_MembraneA_Reef1_Black.Visible = False
        Main_MembraneA_Reef1_White.Visible = False
        Main_MembraneA_Reef1_Yellow.Visible = False
        Main_MembraneA_Reef2_Black.Visible = False
        Main_MembraneA_Reef2_White.Visible = False
        Main_MembraneA_Reef2_Yellow.Visible = False
        Main_MembraneA_Reef3_Black.Visible = False
        Main_MembraneA_Reef3_White.Visible = False
        Main_MembraneA_Reef3_Yellow.Visible = False
        Main_MembraneB_Reef1_Black.Visible = False
        Main_MembraneB_Reef1_White.Visible = False
        Main_MembraneB_Reef1_Yellow.Visible = False
        Main_MembraneB_Reef2_Black.Visible = False
        Main_MembraneB_Reef2_White.Visible = False
        Main_MembraneB_Reef2_Yellow.Visible = False
        Main_MembraneB_Reef3_Black.Visible = False
        Main_MembraneB_Reef3_White.Visible = False
        Main_MembraneB_Reef3_Yellow.Visible = False
        Main_ExternalRings.Visible = False
        Main_InternalRings.Visible = False
        Main_XCut_Reef1.Visible = False
        Main_XCut_Reef2.Visible = False
        Main_XCut_Reef3.Visible = False
        Main_Trioptimal_Reef1.Visible = False
        Main_Trioptimal_Reef2.Visible = False
        Main_Trioptimal_Reef3.Visible = False
        Main_Cunningham.Visible = False
        Main_Trimstripe2_Black.Visible = False
        Main_Trimstripe2_Blue.Visible = False
        Main_Trimstripe2_Red.Visible = False

        'Genoa
        Genoa_Seams_XCut.Visible = False
        Genoa_Seams_Trioptimal.Visible = False
        Genoa_Patches_XCut.Visible = False
        Genoa_Grey.Visible = False
        Genoa_Yellow.Visible = False
        Genoa_Black.Visible = False
        Genoa_Gradient.Visible = False
        Genoa_MembraneA_Black.Visible = False
        Genoa_MembraneA_White.Visible = False
        Genoa_MembraneA_Yellow.Visible = False
        Genoa_MembraneB_Black.Visible = False
        Genoa_MembraneB_White.Visible = False
        Genoa_MembraneB_Yellow.Visible = False
        Genoa_MembraneC_Black.Visible = False
        Genoa_MembraneC_White.Visible = False
        Genoa_MembraneC_Yellow.Visible = False
        Genoa_Patches_Membrane.Visible = False
        Genoa_Patches_Trioptimal.Visible = False
        Genoa_ExternalRings.Visible = False
        Genoa_InternalRings.Visible = False
        Genoa_TrimStripe_Black.Visible = False
        Genoa_Trimstripe_Blue.Visible = False
        Genoa_Trimstripe_Red.Visible = False

        Main_Trimstripe2_Red.Visible = False

        'Jib
        Jib_Seams_XCut.Visible = False
        Jib_Seams_Trioptimal.Visible = False
        Jib_Patches_XCut.Visible = False
        Jib_Grey.Visible = False
        Jib_Yellow.Visible = False
        Jib_Black.Visible = False
        Jib_Gradient.Visible = False
        Jib_MembraneA_Black.Visible = False
        Jib_MembraneA_White.Visible = False
        Jib_MembraneA_Yellow.Visible = False
        Jib_MembraneB_Black.Visible = False
        Jib_MembraneB_White.Visible = False
        Jib_MembraneB_Yellow.Visible = False
        Jib_MembraneC_Black.Visible = False
        Jib_MembraneC_White.Visible = False
        Jib_MembraneC_Yellow.Visible = False
        Jib_Patches_Membrane.Visible = False
        Jib_Patches_Trioptimal.Visible = False
        Jib_ExternalRings.Visible = False
        Jib_InternalRings.Visible = False
        Jib_TrimStripe_Black.Visible = False
        Jib_Trimstripe_Blue.Visible = False
        Jib_Trimstripe_Red.Visible = False

    End Sub

    Sub DrawMain()
         Main_Gradient.Visible = True
        If XCut Then
            Main_Seams_XCut.Visible = True
            Main_Patches_XCut.Visible = True
            If Battens4 Then
                Main_Battens_XCut_4.Visible = True
            ElseIf Battens5 Then
                ' Main_Battens_XCut_5.Visible = False
            End If
            If Reef > 0 Then
                Main_XCut_Reef1.Visible = True
            End If
            If Reef > 1 Then
                Main_XCut_Reef2.Visible = True
            End If
            If Reef > 2 Then
                Main_XCut_Reef3.Visible = True
            End If

        ElseIf Trioptimal Then
            Main_Seams_Trioptimal.Visible = True
            Main_Patches_Trioptimal.Visible = True
            'If Battens4 Then
            '    Main_Battens_XCut_4.Visible = True
            'ElseIf Battens5 Then
            ' Main_Battens_XCut_5.Visible = False
            '  End If
            If Reef > 0 Then
                Main_Trioptimal_Reef1.Visible = True
            End If
            If Reef > 1 Then
                Main_Trioptimal_Reef2.Visible = True
            End If
            If Reef > 2 Then
                Main_Trioptimal_Reef3.Visible = True
            End If


        ElseIf Membrane Then
            Main_Patches_Membrane.Visible = True
            Main_InternalRings.Visible = True
            If YarnColour = "W" Then
                Main_Grey.Visible = True
                Select Case TierCode
                    Case 1
                        Main_MembraneA_White.Visible = True
                        Main_ExternalRings.Visible = True
                        Main_InternalRings.Visible = False

                        If Reef > 0 Then
                            Main_MembraneA_Reef1_White.Visible = True
                        End If
                        If Reef > 1 Then
                            Main_MembraneA_Reef2_White.Visible = True
                        End If
                        If Reef > 2 Then
                            Main_MembraneA_Reef3_White.Visible = True
                        End If
                    Case 3
                        Main_MembraneC_White.Visible = True
                        If Reef > 0 Then
                            Main_MembraneB_Reef1_White.Visible = True
                        End If
                        If Reef > 1 Then
                            Main_MembraneB_Reef2_White.Visible = True
                        End If
                        If Reef > 2 Then
                            Main_MembraneB_Reef3_White.Visible = True
                        End If
                    Case 4
                        Main_MembraneC_White.Visible = True
                        If Reef > 0 Then
                            Main_MembraneB_Reef1_White.Visible = True
                        End If
                        If Reef > 1 Then
                            Main_MembraneB_Reef2_White.Visible = True
                        End If
                        If Reef > 2 Then
                            Main_MembraneB_Reef3_White.Visible = True
                        End If
                    Case Else
                        Main_MembraneB_White.Visible = True
                        If Reef > 0 Then
                            Main_MembraneB_Reef1_White.Visible = True
                        End If
                        If Reef > 1 Then
                            Main_MembraneB_Reef2_White.Visible = True
                        End If
                        If Reef > 2 Then
                            Main_MembraneB_Reef3_White.Visible = True
                        End If
                End Select
            ElseIf YarnColour = "Y" Then

                Main_Yellow.Visible = True
                Select Case TierCode
                    Case 1
                        Main_MembraneA_Yellow.Visible = True
                        Main_ExternalRings.Visible = True
                        Main_InternalRings.Visible = False
                        If Reef > 0 Then
                            Main_MembraneA_Reef1_Yellow.Visible = True
                        End If
                        If Reef > 1 Then
                            Main_MembraneA_Reef2_Yellow.Visible = True
                        End If
                        If Reef > 2 Then
                            Main_MembraneA_Reef3_Yellow.Visible = True
                        End If
                    Case 3
                        Main_MembraneC_Yellow.Visible = True
                        If Reef > 0 Then
                            Main_MembraneB_Reef1_Yellow.Visible = True
                        End If
                        If Reef > 1 Then
                            Main_MembraneB_Reef2_Yellow.Visible = True
                        End If
                        If Reef > 2 Then
                            Main_MembraneB_Reef3_Yellow.Visible = True
                        End If
                    Case 4
                        Main_MembraneC_Yellow.Visible = True
                        If Reef > 0 Then
                            Main_MembraneB_Reef1_Yellow.Visible = True
                        End If
                        If Reef > 1 Then
                            Main_MembraneB_Reef2_Yellow.Visible = True
                        End If
                        If Reef > 2 Then
                            Main_MembraneB_Reef3_Yellow.Visible = True
                        End If
                    Case Else
                        Main_MembraneB_Yellow.Visible = True
                        If Reef > 0 Then
                            Main_MembraneB_Reef1_Yellow.Visible = True
                        End If
                        If Reef > 1 Then
                            Main_MembraneB_Reef2_Yellow.Visible = True
                        End If
                        If Reef > 2 Then
                            Main_MembraneB_Reef3_Yellow.Visible = True
                        End If
                End Select
            Else
                Main_Black.Visible = True
                Select Case TierCode
                    Case 1
                        Main_MembraneA_Black.Visible = True
                        Main_ExternalRings.Visible = True
                        Main_InternalRings.Visible = False
                        If Reef > 0 Then
                            Main_MembraneA_Reef1_Black.Visible = True
                        End If
                        If Reef > 1 Then
                            Main_MembraneA_Reef2_Black.Visible = True
                        End If
                        If Reef > 2 Then
                            Main_MembraneA_Reef3_Black.Visible = True
                        End If
                    Case 3
                        Main_MembraneC_Black.Visible = True
                        If Reef > 0 Then
                            Main_MembraneB_Reef1_Black.Visible = True
                        End If
                        If Reef > 1 Then
                            Main_MembraneB_Reef2_Black.Visible = True
                        End If
                        If Reef > 2 Then
                            Main_MembraneB_Reef3_Black.Visible = True
                        End If
                    Case 4
                        Main_MembraneC_Black.Visible = True
                        If Reef > 0 Then
                            Main_MembraneB_Reef1_Black.Visible = True
                        End If
                        If Reef > 1 Then
                            Main_MembraneB_Reef2_Black.Visible = True
                        End If
                        If Reef > 2 Then
                            Main_MembraneB_Reef3_Black.Visible = True
                        End If
                    Case Else
                        Main_MembraneB_Black.Visible = True
                        If Reef > 0 Then
                            Main_MembraneB_Reef1_Black.Visible = True
                        End If
                        If Reef > 1 Then
                            Main_MembraneB_Reef2_Black.Visible = True
                        End If
                        If Reef > 2 Then
                            Main_MembraneB_Reef3_Black.Visible = True
                        End If
                End Select
            End If
        End If
        If Cunningham Then
            Main_Cunningham.Visible = True
        End If
        If Race Then
            If TrimStripes Then
                Select Case TrimStripeColour
                    Case "Red"
                        ' Main_Trimstripe3_Red.Visible = True
                    Case "Blue"
                        ' Main_Trimstripe3_Blue.Visible = True
                    Case Else
                        '  Main_Trimstripe3_Black.Visible = True
                End Select
            End If
        Else
            If TrimStripes Then
                Select Case TrimStripeColour
                    Case "Red"
                        Main_Trimstripe2_Red.Visible = True
                    Case "Blue"
                        Main_Trimstripe2_Blue.Visible = True
                    Case Else
                        Main_Trimstripe2_Black.Visible = True
                End Select
            End If
        End If
    End Sub

    Sub DrawGenoa()
        Genoa_Gradient.Visible = True
        If XCut Then
            Genoa_Seams_XCut.Visible = True
            Genoa_Patches_XCut.Visible = True
 
        ElseIf Trioptimal Then
            Genoa_Seams_Trioptimal.Visible = True
            Genoa_Patches_Trioptimal.Visible = True

        ElseIf Membrane Then
            Genoa_Patches_Membrane.Visible = True
            '   Genoa_InternalRings.Visible = True
            If YarnColour = "W" Then
                Genoa_Grey.Visible = True
                Select Case TierCode
                    Case 1
                        Genoa_MembraneA_White.Visible = True
                        Genoa_ExternalRings.Visible = True
                        Genoa_InternalRings.Visible = False
                    Case 3
                        Genoa_MembraneC_White.Visible = True
                     Case 4
                        Genoa_MembraneC_White.Visible = True
                     Case Else
                        Genoa_MembraneB_White.Visible = True
                 End Select
            ElseIf YarnColour = "Y" Then

                Genoa_Yellow.Visible = True
                Select Case TierCode
                    Case 1
                        Genoa_MembraneA_Yellow.Visible = True
                        Genoa_ExternalRings.Visible = True
                        Genoa_InternalRings.Visible = False
                    Case 3
                        Genoa_MembraneC_Yellow.Visible = True
                     Case 4
                        Genoa_MembraneC_Yellow.Visible = True
                    Case Else
                        Genoa_MembraneB_Yellow.Visible = True
                End Select
            Else
                Genoa_Black.Visible = True
                Select Case TierCode
                    Case 1
                        Genoa_MembraneA_Black.Visible = True
                        Genoa_ExternalRings.Visible = True
                        Genoa_InternalRings.Visible = False
                     Case 3
                        Genoa_MembraneC_Black.Visible = True
                    Case 4
                        Genoa_MembraneC_Black.Visible = True
                   Case Else
                        Genoa_MembraneB_Black.Visible = True
                End Select
            End If
        End If
        If TrimStripes Then
            Select Case TrimStripeColour
                Case "Red"
                    Genoa_Trimstripe_Red.Visible = True
                Case "Blue"
                    Genoa_Trimstripe_Blue.Visible = True
                Case Else
                    Genoa_TrimStripe_Black.Visible = True
            End Select
        End If
     End Sub

    Sub DrawJib()
        Jib_Gradient.Visible = True
        If XCut Then
            Jib_Seams_XCut.Visible = True
            Jib_Patches_XCut.Visible = True

        ElseIf Trioptimal Then
            Jib_Seams_Trioptimal.Visible = True
            Jib_Patches_Trioptimal.Visible = True

        ElseIf Membrane Then
            Jib_Patches_Membrane.Visible = True
            '   Jib_InternalRings.Visible = True
            If YarnColour = "W" Then
                Jib_Grey.Visible = True
                Select Case TierCode
                    Case 1
                        Jib_MembraneA_White.Visible = True
                        Jib_ExternalRings.Visible = True
                        Jib_InternalRings.Visible = False
                    Case 3
                        Jib_MembraneC_White.Visible = True
                    Case 4
                        Jib_MembraneC_White.Visible = True
                    Case Else
                        Jib_MembraneB_White.Visible = True
                End Select
            ElseIf YarnColour = "Y" Then

                Jib_Yellow.Visible = True
                Select Case TierCode
                    Case 1
                        Jib_MembraneA_Yellow.Visible = True
                        Jib_ExternalRings.Visible = True
                        Jib_InternalRings.Visible = False
                    Case 3
                        Jib_MembraneC_Yellow.Visible = True
                    Case 4
                        Jib_MembraneC_Yellow.Visible = True
                    Case Else
                        Jib_MembraneB_Yellow.Visible = True
                End Select
            Else
                Jib_Black.Visible = True
                Select Case TierCode
                    Case 1
                        Jib_MembraneA_Black.Visible = True
                        Jib_ExternalRings.Visible = True
                        Jib_InternalRings.Visible = False
                    Case 3
                        Jib_MembraneC_Black.Visible = True
                    Case 4
                        Jib_MembraneC_Black.Visible = True
                    Case Else
                        Jib_MembraneB_Black.Visible = True
                End Select
            End If
        End If
        If TrimStripes Then
            Select Case TrimStripeColour
                Case "Red"
                    Jib_Trimstripe_Red.Visible = True
                Case "Blue"
                    Jib_Trimstripe_Blue.Visible = True
                Case Else
                    Jib_TrimStripe_Black.Visible = True
            End Select
        End If

    End Sub
End Class